import java.text.*;

public class main {

   static public void customFormat(String pattern, double value ) {
      DecimalFormat myFormatter = new DecimalFormat(pattern);
      String output = myFormatter.format(value);
      System.out.println(value + "  " + pattern + "  " + output);
   }

   static public void main(String[] args) {

      customFormat("###,####.####", 123456.789);
//      customFormat("###.##", 123456.789);
 //     customFormat("000000.000", 123.78);
      customFormat("$###,####.####", 123456.789);
   }
}
